module;
 #include <QObject>
#include <QMap>
#include <QString>
#include <QMutex>
#include <QtCore>
#include <QtCore/QPair>
#include <QThread>
export module OpcUaClientThread;
import XYopcUa;

export class OpcUaClientThread : public QThread
{
    Q_OBJECT

public:
    explicit OpcUaClientThread(QObject *parent = nullptr);
    ~OpcUaClientThread();

signals:
    void connectToEndpoint(const QString &address, quint16 port);
    void disconnectFromEndpoint();
    void readNode(const QString &nodeId);
    void readNodes(const QStringList &nodeIds);
    void writeNode(const QString &nodeId, const QVariant &value);
    void writeNodes(const QMap<QString, QVariant> &nodes);

    void connected();
    void nodesRead(const QMap<QString, QVariant> &values);
    void nodesWritten(const QMap<QString, bool> &results);
    void disconnected();
    void errorOccurred(const QString &error);
    void nodeValueRead(const QString &nodeId, const QVariant &value);
    void nodeValueWritten(const QString &nodeId, bool success);

protected:
    void run() override;

private:
    OpcUaClient *m_client;
};

